package mani.threads.sync;

public class SyncTest {
	public static void main(String arg[]){
		Account account = new Account();
		account.setBalance(1000);
		
		Bank bank = new Bank(account);
		Thread bankThread = new Thread(bank);
		
		Person person = new Person(account);
		Thread personThread = new Thread(person);
		System.out.println("Initial balance---"+account.getBalance());
		bankThread.start();
		personThread.start();
		
		try {
			bankThread.join();
			personThread.join();
			
			System.out.println("Final balance---"+account.getBalance());
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
	}
}
